package com.test.demo.io.bio;

import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;

public class BIOSocktServer {

    public static void main(String[] args) throws IOException {
        ServerSocket serverSocket = new ServerSocket(9000);
        System.out.println("BIOServer启动了");
        while (true) {
            Socket socket = serverSocket.accept();
            System.out.println("有客户端连接了");
            byte[] bytes = new byte[1024];
            socket.getInputStream().read(bytes);
            System.out.println("接收到客户端数据" + new String(bytes));
            socket.getOutputStream().write("HelloClient".getBytes());
            socket.getOutputStream().flush();
        }
    }
}
